package com.zhiyou.servlet;

import com.zhiyou.model.House;
import com.zhiyou.service.ContractService;
import com.zhiyou.service.impl.ContractServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

public class ContractDeleteServlet extends HttpServlet {
    private ContractService cS=new ContractServiceImpl();
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        req.setCharacterEncoding("utf-8");
        resp.setContentType("text/html;charset=utf-8");
        System.out.println("删除执行");
        String idStr = req.getParameter("cid");
        System.out.println(idStr);
        int cid=Integer.parseInt(idStr);
        cS.deleteById(cid);
        //new HouseDao().deleteById(hid);
        //
        resp.sendRedirect(req.getContextPath()+"/user/contract?pageNo="+req.getParameter("pageNo"));
    }
}
